#!/usr/bin/env python3

# Minimal job that runs an also minimal executable test

import os
import sys
import tempfile

from avocado.core.job import Job
from avocado.core.suite import TestSuite

test_results_dir = tempfile.TemporaryDirectory()

config = {
    "run.results_dir": test_results_dir.name,
    'resolver.references': [
        os.path.join(os.path.dirname(__file__), 'tests', 'pass'),
        os.path.join(os.path.dirname(__file__), 'tests', 'passtest.py')
        ]
    }

suite = TestSuite.from_config(config)
with Job(config, [suite]) as j:
    exit_code = j.run()
    test_results_dir.cleanup()
    sys.exit(exit_code)
